include ../config.mk

cppflags := $(cppflags) -I../include

ccsrc := $(wildcard *.cc)
ccobj := $(patsubst %.cc,%.o,$(ccsrc))

cusrc := $(wildcard *.cu)
cuobj := $(patsubst %.cu,%.o,$(cusrc))


l1spirit.out: $(ccobj) $(cuobj) ../libmri.o
	$(c++) -o $@ $(ccobj) $(cuobj) ../libmri.o $(ldflags)

.PHONY: ../libmri.o
../libmri.o:
	$(MAKE) -C ../ libmri.o

%.o: %.cc
	$(c++) -o $@ -c $< $(c++flags) $(cppflags)

%.o: %.cu
	$(nvcc) -o $@ -c $< $(nvccflags) $(cppflags)

clean:
	rm -f *.o l1spirit.out

dep:
	$(c++) -MM $(cppflags) $(ccsrc) > deps.mk

ifneq ($(MAKECMDGOALS),dep)
  include deps.mk
endif
